﻿#region 命名空间

using System;
using System.Web.UI.WebControls;
using WinnerCMS.BLL;
using WinnerCMS.Model.Attribute;

#endregion

namespace WinnerCMS.WebUI.Admin.Template
{
    [Access("263002,263003")]
    public partial class Manage : WebFactory.PageBase
    {
        private bool T_Delete;
        private bool T_Edit;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.T_Delete = RightsCheck.HasRight("T_2");
            this.T_Edit = RightsCheck.HasRight("T_3");
            if (!IsPostBack)
            {
                this.lblPath.Text = "模板集管理";
                Bind();
            }
        }

        private void Bind()
        {
            this.GV_List.DataSource = new TemplatesManage().BindList();
            this.GV_List.DataBind();
        }


        protected void GV_List_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            switch (e.CommandName)
            {
                case "UsedIt":
                    new TemplatesManage().UsedIt(e.CommandArgument.ToString(), this.UpdatePanel1);


                    Bind();
                    break;
                case "Template_Delete":
                    var Index = Convert.ToInt32(e.CommandArgument);
                    var ID = this.GV_List.DataKeys[Index].Value.ToString();
                    new TemplatesManage().Delete(ID, this.UpdatePanel1);


                    Bind();
                    break;
            }
        }
    }
}